ppt.onStart = function () {
    Laya.stage.alignH = Laya.Stage.ALIGN_CENTER;
    Laya.stage.alignV = Laya.Stage.ALIGN_MIDDLE;
    Laya.stage.screenMode = Laya.Stage.SCREEN_HORIZONTAL;
    // Laya.stage.scaleMode = Laya.Stage.SCALE_FIXED_WIDTH,

    Laya.URL.basePath = CDN_URL;
    Laya.URL.version = ASSETS_VERSION;

    // Laya.DebugPanel.init()

    Laya.SoundManager.setMusicVolume(0.4);
    Laya.SoundManager.autoStopMusic = false;

    ppt.io.connect(IO_CONFIG);
    ppt.director.runScene(new Scene.Start());

    ppt.io.register({
        "io.end": function () {
            var config = {
                msg: "网络开小差了，刷新一下马上回来！",
                close: false,
                btn: {
                    btnCancel: false,
                    btnConfirm: {
                        skin: "confirm",
                        click: function () {
                            location.reload();
                        }
                    }
                }
            }
            if (PUBLIC_ASSETS_LOADED) {
                ppt.director.popScene(new Alert.Public(config));
               
            } else {
                alert("网络开小差了，刷新一下马上回来！")
                location.reload();
            }
        },
        "conn::error": function (data) {
            var config = {
                msg: "您的账号已在别处登录！",
                close: false,
                btn: {
                    btnCancel: false,
                    btnConfirm: {
                        skin: "confirm",
                        click: function () {
                            location.reload();
                        }
                    }
                }
            }
            if (data.code == "1003") {
                ppt.io.unregister("io.end");
                if (PUBLIC_ASSETS_LOADED) {
                   
                    ppt.director.popScene(new Alert.Public(config));
                } else {
                    alert("您的账号已在别处登录！");
                    location.reload();
                }
            }
        }
    });
}
ppt.run(GAME_CONFIG.WIDTH, GAME_CONFIG.HEIGHT);